package cn.wb.user.dto;

import cn.wb.base.util.MD5Utils;
import cn.wb.base.util.StrUtils;
import cn.wb.user.domain.User;
import lombok.Data;

import java.util.Date;

@Data
public class BinderDto {

   private String phone;
   private String verifyCode;
   private String accessToken;
   private String openId;

   public User getUser(){
      String salt = StrUtils.getComplexRandomString(32);
      // 密码 我通过 盐值+密码 加密
      String password = MD5Utils.encrypByMd5(salt + "1");
      return User.builder()
              .username(this.phone)
              .phone(this.phone)
              .salt(salt)
              .password(password)
              .state(1)
              .createtime(new Date())
              .build();
   }
}
